package cc.comac.mom.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipInventoryService;
import cc.comac.mom.bean.EquipInventory;
import cc.comac.mom.bean.EquipInventoryBean;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.datahandlers.entity.EquipInventoryDataHandler;
import cc.comac.mom.util.ResultBean;
@Service
@RestController
public class EquipInventoryServiceImpl implements EquipInventoryService {

	@Autowired
	private EquipInventoryDataHandler equipInventoryDataHandler;
	
	@Override
	public ResultBean saveInventoryAndSpareData(@RequestBody EquipInventoryBean equipInventoryBean) {
		
		return equipInventoryDataHandler.saveInventoryAndSpareData(equipInventoryBean);
	}

	@Override
	public ResultDev selectBySomeFields(@RequestBody EquipInventory equipInventory) {
		ResultDev resultDev = new ResultDev();
		if (equipInventory.getSearchAll() != 1) {
			resultDev = equipInventoryDataHandler.selectBySomeFields(equipInventory);
		} else {
			resultDev = equipInventoryDataHandler.selectAll();
		}
		return resultDev;
	}

	@Override
	public ResultBean batchDelete(@RequestBody List<EquipInventory> list) {
		
		return equipInventoryDataHandler.batchDelete(list);
	}

	@Override
	public ResultBean spareInWarehouseUpdateQuantity(@RequestBody List<EquipInventory> list) {
		return equipInventoryDataHandler.batchSpareInWarehouseUpdateQuantity(list);
	}

	@Override
	public ResultBean updateInventorySpare(@RequestBody EquipInventoryBean equipInventoryBean) {
		// TODO Auto-generated method stub
		return equipInventoryDataHandler.updateInventorySpare(equipInventoryBean);
	}

}
